package cn.echisan.springbootjwtdemo.service;

import cn.echisan.springbootjwtdemo.entity.JdbcUser;
import cn.echisan.springbootjwtdemo.entity.JwtUser;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * Created by echisan on 2018/6/23
 */
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
        JdbcUser user = new JdbcUser();
        user.setId(9527);
        user.setUsername("AE86");
        user.setPassword("{bcrypt}$2a$10$XrUKXDgDXq1J8x.F17AH2.y465FrEzKJ/mNiOlyRaGgTjR67aByyy");
        user.setRole("ROLE_USER");
        return new JwtUser(user);
    }
}
